<%@page import="code.CodeDAO"%>
<%@page import="code.CodeDTO"%>
<%@page import="java.text.DecimalFormat"%>
<%@page import="salary.SalaryMyba"%>
<%@page import="salary.SalaryVo"%>
<%@page import="java.util.ArrayList"%>
<%@page import="salary.SalaryMyba"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<link rel="stylesheet" href="http://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css" />
<script src="http://code.jquery.com/jquery-1.9.1.js"></script>
<script src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath}/FullCalendar/jquery.ui.datepicker-ko.js"></script>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>사원등록</title>
<script src="${pageContext.request.contextPath}/homepage/salary/filePreview.js"></script>
<style type="text/css">
#center {
    z-index: 10;
	width: 993px;
	height: 90px;
	border: 1px solid #cccccc;
	position: relative;
	background-color: #F2F2F2;
	background-repeat: no-repeat;
	background-size: 100% 100%;
	border-radius: 5px;
	margin-left: 100px;
}

#menubar {
	width: 1000px;
	height: 0px;
	margin:auto;
}

#subject {
	width: 100px;
	border: 1px solid #eaeaea;
	float: left;
	text-align: center;
	height: 30px;
	line-height: 30px;
	border-left: 1px solid;
	border-right:1px solid;
	
}

.subject1 {
	text-indent: 3px;
	width: 200px;
	height: 20px;
	line-height: 20px; 
	margin-top:3px; 
	margin-left:10px;
}

#previewId{
	margin:auto;
	width: 100px;
	border: 1px solid #cccccc;
	height: 130px;
	float: left;
}

#b{
	width: 992px;
	
}

#c{
	width: 100px;
	border: 1px solid #eaeaea;
	float: left;
	text-align: center;
	height: 30px;
	line-height: 30px;
	border-left: 1px solid;
	border-right:1px solid;

}

.d{
	text-indent: 3px;
	width: 180px;
	height: 20px;
	line-height: 20px; 
	margin-top:3px; 
	margin-left:10px;

}
</style>
<script type="text/javascript">
window.onload = function () {
	$("#age").datepicker({
		buttonImageOnly: true, //이미지만 보이기
		changeMonth: true,
		changeYear: true,
		autoSize: true,
		dateFormat: 'yymmdd'
	});
	
	
};

</script>
</head>
<body>
	<jsp:useBean id="vo" class="salary.SalaryVo" />
	<jsp:setProperty property="*" name="vo" />
<%
DecimalFormat df = new DecimalFormat("###,###,###.##");
SalaryMyba salary = new SalaryMyba();
salary.setSalaryvo(vo);
SalaryVo s = salary.view();

String pa = s.getSA_sx();
String pa1 = s.getSA_gd();
String pa2 = s.getSA_dpm();
String pa3 = s.getSA_st();
String pa4 = s.getSA_marr();
String pa5 = s.getSA_home();
String pa6 = s.getSA_car();
%>
<script>

window.onload = function(){
	var con = document.getElementById("sx");
	<%if(pa.equals("성별")){%> con.options[0].selected = true;
	<%}else if(pa.equals("남자")){%> con.options[1].selected = true;
	<%}else if(pa.equals("여자")){%> con.options[2].selected = true;
	<%}%>
	
	<%-- var con = document.getElementById("gd");
	<%if(pa1.equals("01")){%> con.options[0].selected = true;
	<%}else if(pa1.equals("02")){%> con.options[1].selected = true;
	<%}else if(pa1.equals("03")){%> con.options[2].selected = true;
	<%}else if(pa1.equals("04")){%> con.options[3].selected = true;
	<%}else if(pa1.equals("05")){%> con.options[4].selected = true;
	<%}%> --%>
	
	$("#gd").val("0"+<%=pa1%>);
	
	$("#dpm").val("0"+<%=pa2%>);
	
	<%-- var con = document.getElementById("dpm");
	
	<%if(pa2.equals("01")){%> con.options[0].selected = true;
	<%}else if(pa2.equals("02")){%> con.options[1].selected = true;
	<%}else if(pa2.equals("03")){%> con.options[2].selected = true;
	<%}else if(pa2.equals("04")){%> con.options[3].selected = true;
	<%}%> --%>
	
	var con = document.getElementById("st");
	<%if(pa3.equals("01")){%> con.options[0].selected = true;
	<%}else if(pa3.equals("02")){%> con.options[1].selected = true;
	<%}else if(pa3.equals("03")){%> con.options[2].selected = true;
	<%}else if(pa3.equals("04")){%> con.options[3].selected = true;
	<%}else if(pa3.equals("05")){%> con.options[4].selected = true;
	<%}%>
	
	var con = document.getElementById("marr");
	<%if(pa4.equals("결혼")){%> con.options[0].selected = true;
	<%}else if(pa4.equals("Y")){%> con.options[1].selected = true;
	<%}else if(pa4.equals("N")){%> con.options[2].selected = true;
	<%}%>
	
	var con = document.getElementById("home");
	<%if(pa4.equals("주택")){%> con.options[0].selected = true;
	<%}else if(pa4.equals("Y")){%> con.options[1].selected = true;
	<%}else if(pa4.equals("N")){%> con.options[2].selected = true;
	<%}%>
	
	var con = document.getElementById("car");
	<%if(pa4.equals("차량")){%> con.options[0].selected = true;
	<%}else if(pa4.equals("Y")){%> con.options[1].selected = true;
	<%}else if(pa4.equals("N")){%> con.options[2].selected = true;
	<%}%>
};
</script>
<div style="height:20px"></div>
	<!-- 컨텐츠 안에서 탑  --> 
	<form id="frm" action="index.jsp?inc_content=./salary/salary_modify_result.jsp" method="post" enctype="multipart/form-data">
	<div id='center'>
		<h3>&nbsp;&nbsp;&nbsp;사원 등록</h3>
		<input type="button" value="목록" style='margin-top: 0px; margin-right: 5px; float: right; width:100px'
		 onclick="history.back()">
		<input type='submit' value='수정'   
			style='margin-top: 0px; margin-right: 10px; float: right; width:100px'>
			
	</div>
	
	<!-- 강제로 높이 지정 -->
	<div style="height: 300px; width: 1200px;">

 <!-- 공통코드 사용할때 가져오는.. grp1이 대분류-->
 <%  
	CodeDTO code = new CodeDTO();
	code.setCd_grp1("PST");
	CodeDAO cdao = new CodeDAO();
	cdao.setDto(code);
	ArrayList<CodeDTO> codess = cdao.returnCode();
 %>
 
 <%  
	CodeDTO code1 = new CodeDTO();
	code1.setCd_grp1("SADP");
	CodeDAO cdao1 = new CodeDAO();
	cdao1.setDto(code1);
	ArrayList<CodeDTO> codess1 = cdao1.returnCode();
 %>
 
 <%  
	CodeDTO code2 = new CodeDTO();
	code2.setCd_grp1("SAST");
	CodeDAO cdao2 = new CodeDAO();
	cdao2.setDto(code2);
	ArrayList<CodeDTO> codess2 = cdao2.returnCode();
 %>
							
		<div id="menubar" style='margin-top: 20px;'>
		<div id='previewId'><img src="../homepage/salary/photo/<%=s.getSA_pho()%>" style="width: 100px; height: 130px;" id='p'> </div>
		<div id="b" style="border-right: 1px solid #cccccc"> <!-- 감싸고 -->
			<div style='border-top: 1px solid; float: left; border-right: 1px solid'>
				<div id= "c">사원번호</div>
				<div style="width: 338px; float: left;">
					<input type='text' class="d" value='<%=s.getSA_no() %>' name='no' readonly="readonly">
				</div>
				<div id="c">성별</div>
				<div style="width: 347px; float: left;">
					<select style="height: 25px;line-height: 20px; margin-top:3px; margin-left:10px;" name='sx' id='sx'>
					<option value="성별">성별</option>
					<option value="남자">남자</option>
					<option value="여자">여자</option>
				</select>
				</div>
				</div>
				<div style='border-top: 1px solid; float: left; border-right: 1px solid'>
				<div id= "c">사원명</div>
				<div style="float: left; width: 338px;">
					<input type='text' class="d" value='<%=s.getSA_nm() %>' name='nm' id='id'>
				</div>	
				<div id="c">직급</div>
				<div style="width: 347px; float: left;">
					<select style="height: 25px;line-height: 20px; margin-top:3px; margin-left:10px;" name='gd' id='gd'>
			    
			    <!-- 셀렉트박스 돌려서 칸늘리기 grp2가 소분류, 소불류 명-->
			    <%
				for(int i=0; i<codess.size();i++){
				CodeDTO d = codess.get(i);
				%>
				<option value="<%=d.getCd_grp2()%>"><%=d.getCd_grp2_nm() %></option>
				<%}%>
				</select>
				</div>
				</div>
			<div style='border-top: 1px solid; float: left; border-right: 1px solid'>
				<div id="c">연락처</div>
				<div style="width: 338px; float: left;">
					<input type='text' class="d" value='<%=s.getSA_ph() %>' name='ph'>
				</div>
				<div id="c">나이</div>
				<div style="width: 347px; float: left;">
					<input type='text' class="d" value='<%=s.getSA_age() %>세' name='age' id='age' readonly="readonly">
				</div>
			</div>
			<div style='border-top: 1px solid; float: left; border-right: 1px solid'>
				<div id="c">사진 업로드</div>
				<div style="width: 338px; float: left;">
					<input type='file' class="d" value='<%=s.getSA_pho() %>' style="margin-top:3px; width: 300px; margin-top: 4px;" id='photo' name="photo" onchange="previewImage(this,'previewId','2')">
				<input type='hidden' class="d" value='<%=s.getSA_pho() %>' name="photo1">
				</div>
				<div id="c">이메일</div>
				<div style="width: 347px; float: left;">
					<input type='text' class="d" value='<%=s.getSA_email() %>' name='email'>
				</div>
			</div>
		</div>
			<div style='border-top: 1px solid; float: left; border-right: 1px solid'>
				<div id="subject">주소</div>
				<div style="width: 889px; float: left;">
					<input type='text' class="subject1" style="width:528px;" value='<%=s.getSA_address() %>' name='address'>
				</div>
			</div>
            <div style='border-top: 1px solid; float: left; border-right: 1px solid'>
				<div id="subject">부서</div>
				<div style="width: 439px; float: left;">
					<select style="height: 25px;line-height: 20px; margin-top:3px; margin-left:10px;" name='dpm' id='dpm'>
				<%
				for(int i=0; i<codess1.size();i++){
				CodeDTO d = codess1.get(i);
				%>
				<option value="<%=d.getCd_grp2()%>"><%=d.getCd_grp2_nm() %></option>
				<%}%>
				</select>
				</div>
				<div id="subject">상태코드</div>
				<div style="width: 348px; float: left;">
					<select style="height: 25px;line-height: 20px; margin-top:3px; margin-left:10px;" name='st' id='st'>
				<%
				for(int i=0; i<codess2.size();i++){
				CodeDTO d = codess2.get(i);
				%>
				<option value="<%=d.getCd_grp2()%>"><%=d.getCd_grp2_nm() %></option>
				<%}%>
				</select>
				</div>
				</div>
				<div style='border-top: 1px solid; float: left; border-right: 1px solid'>
				<div id="subject">입사일</div>
				<div style="width: 439px; float: left;">
					<input type='text' class="subject1" value='<%=s.getSA_hd() %>' style="width: 283px;" name='hd' readonly="readonly">
				</div>
				
				<div id="subject">연봉</div>
				<div style="width: 348px; float: left;">
					<input type='text' class="subject1" value='<%=s.getSA_sal() %>' style="width: 180px;" name='sal'>
				</div>
				</div>
		
				<!-- 빈공간으로 만듬 한줄 띄운 효과발동!! -->
				<div style='border-top: 1px solid ; float: left; border-right: 1px solid white; height:10px;'>
				<div id= "subject" style="border-left: 0px solid white; border-right: 0px solid #ffffff; border-bottom: 0px solid white;" ></div>
				<div style="width: 890px; float: left;">
					</div>
				</div>
				<div style='border-top: 1px solid; float: left; border-right: 1px solid'>
				<div id="subject">결혼</div>
				<div style="width: 890px; float: left;">
					<select style="height: 25px;line-height: 20px; margin-top:3px; margin-left:10px;" name='marr' id='marr'>
					<option value="결혼">결혼</option>
					<option value="Y">Y</option>
					<option value="N">N</option>
				</select>
				</div>
				</div>
				<div style='border-top: 1px solid; float: left; border-right: 1px solid'>
				<div id="subject">주택소유여부</div>
				<div style="width: 890px; float: left;">
					<select style="height: 25px;line-height: 20px; margin-top:3px; margin-left:10px;" name='home' id='home'>
					<option value="주택">주택</option>
					<option value="Y">Y</option>
					<option value="N">N</option>
				</select>
				</div>
				</div>
				<div style='border-top: 1px solid; float: left; border-right: 1px solid'>
				<div id="subject">차량소유여부</div>
				<div style="width: 890px; float: left;">
					<select style="height: 25px;line-height: 20px; margin-top:3px; margin-left:10px;" name='car' id='car'>
					<option value="차량">차량</option>
					<option value="Y">Y</option>
					<option value="N">N</option>
				</select>
				</div>
				</div>
				<div style='border-top: 1px solid; float: left; border-right: 1px solid'>
				<div id="subject">은행명</div>
				<div style="width: 440px; float: left;">
					<input type='text' class="subject1" value='<%=s.getSA_bknm() %>' style="width: 283px;" name='bknm'>
				</div>
			
				<div id="subject">예금주명</div>
				<div style="width: 348px; float: left;">
					<input type='text' class="subject1" value='<%=s.getSA_pynm() %>' style="width: 180px;" name='pynm'>
				</div>
			</div>
			<div style='border-top: 1px solid; border-bottom: 1px solid; float: left; border-right: 1px solid'>
				<div id="subject">계좌번호</div>
				<div style="width: 890px; float: left;">
					<input type='text' class="subject1" value='<%=s.getSA_acc() %>' style="width: 283px;" name='acc'>
				</div>
				
			</div>
			<div style="celar:both"></div>
		  <div style="height:10px"></div>
		  </div>
		  
	   </div>
	   
	</form>
	
	
</body>
</html>






